package gaspider;

import java.util.Calendar;
import java.util.Date;

public class DateDemo2 {  
    @SuppressWarnings("deprecation")  
    public static void main(String args[]) {  
        Date date = new Date();  
          
        System.out.println("date.toString: " + date.toString());  
        System.out.println("date: " + date.getDate());  
        System.out.println("day: " + date.getDay());  
        System.out.println("hour: " + date.getHours());  
        System.out.println("minutes: " + date.getMinutes());  
        System.out.println("month: " + (date.getMonth() + 1));  
        System.out.println("seconds: " + date.getSeconds());  
        System.out.println("time: " + date.getTime());  
        System.out.println("timezone: " + date.getTimezoneOffset());  
        System.out.println("year: " + (date.getYear() + 1900));  
          
        Calendar calendar = Calendar.getInstance();  
        int year = calendar.get(Calendar.YEAR);  
        int month = calendar.get(Calendar.MONTH) + 1;  
        int day = calendar.get(Calendar.DATE);  
        int hour = calendar.get(Calendar.HOUR);  
        int minute = calendar.get(Calendar.MINUTE);  
        int second = calendar.get(Calendar.SECOND);  
          
        System.out.println("----------Calendar-------");  
        System.out.println("year: " + year);  
        System.out.println("month: " + month);  
        System.out.println("day: " + day);  
        System.out.println("hour: " + hour);  
        System.out.println("minute: " + minute);  
        System.out.println("second: " + second);  
          
    }  
}  